<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="ie=edge" />
        <title>Document</title>
        <link rel="stylesheet" href="./fonts/iconfont.css" />
    </head>
    <style>
        .wrap {
            margin-top: 100px;
            text-align: center;
            display: flex;
            flex-direction: column;
        }
        #btn {
            font-size: 24px;
            border: 1px solid #c30c1f;
            background: #fff;
            padding: 8px 30px;
            border-radius: 30px;
            display: inline-block;
            color: #c30c1f;
            margin: 40px auto;
        }
        .logo {
            width: 200px;
            height: 200px;
            display: inline-block;
            margin: 0 auto;
        }
        .ios {
            display: inline-block;
            background: url("./imgs/ios.png") no-repeat;
            width: 200px;
            height: 50px;
            background-size: contain;
            margin: 20px auto;
        }
        .android {
            background: url("./imgs/android.png") no-repeat;
            width: 200px;
            height: 50px;
            display: inline-block;
            background-size: contain;
            margin: 0 auto;
        }
        .btn {
            display: flex;
            flex-direction: column;
            margin-top: 30px;
        }
        .mask {
            position: fixed;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            background-color: rgba(0, 0, 0, 0.8);
            z-index: 99;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 15px;
            display: none;
        }
        .circle {
            color: #fff;
            background: red;
            width: 26px;
            line-height: 26px;
            text-align: center;
            height: 26px;
            display: inline-block;
            border-radius: 13px;
            margin-right: 10px;
        }
        .content p {
            display: block;
            color: #fff;
        }
        /* iconfont */
        .iconfont {
            font-size: 22px;
        }
        .arrow {
            background: url("./imgs/arrow.png") no-repeat;
            background-size: contain;
            display: inline-block;
            width: 60px;
            height: 60px;
            position: fixed;
            top: 60px;
            right: 60px;
        }
    </style>
    <body>
        <div class="wrap">
            <img class="logo" src="./imgs/512.png" alt="" />
            <div class="btn">
                <span class="ios"></span>
                <span class="android"></span>
            </div>
        </div>
        <div class="mask">
            <span class="arrow"></span>
            <div class="content">
                <p>
                    <span class="circle">1</span>点击右上角的
                    <span class="iconfont icon-menu"></span> 按钮
                </p>
                <p><span class="circle">2</span>选择 在浏览器中打开 本页</p>
            </div>
        </div>
    </body>
    <script>
        // 点击ios 启动itms协议
        document.querySelector(".ios").addEventListener("click", function() {
            window.location =
                "itms-services:///?action=download-manifest&url=https://gitee.com/doyouz/downDemo/raw/master/qrcode.plist";
        });

        // 点击android弹出mask
        document
            .querySelector(".android")
            .addEventListener("click", function() {
                // 判断是否微信
                var isWX = (function() {
                    return (
                        navigator.userAgent
                            .toLowerCase()
                            .indexOf("micromessenger") !== -1
                    );
                })();

                if (isWX) {
                    document.querySelector(".mask").style.display = "flex";
                    document.querySelector(".wrap").style.filter = "blur(5px)";
                    document.querySelector(".wrap").style.transition =
                        "filter 1s";
                    return;
                }
                window.location.href =
                    "http://192.168.1.106:8080/SxgwPhoneServer/VersionPath/sxgw_android.apk";
            });

        // 隐藏mask
        document.querySelector(".mask").addEventListener("click", function() {
            this.style.display = "none";
            document.querySelector(".wrap").style.filter = "blur(0px)";
        });

        // 如果是android端,并且是浏览器打开 直接下载
        if (
            (navigator.userAgent.indexOf("Android") > -1 ||
                navigator.userAgent.indexOf("Adr") > -1) &&
            navigator.userAgent.toLowerCase().indexOf("micromessenger") === -1
        ) {
            window.location.href =
                "http://192.168.1.106:8080/SxgwPhoneServer/VersionPath/sxgw_android.apk";
        }
    </script>
</html>
